package com.project.service;

import com.project.dao.ClassMapper;
import com.project.entity.Class;
import com.project.service.base.BaseService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import java.util.List;

@Transactional(rollbackFor = {Exception.class})
@Service
public class ClassServiceImpl extends BaseService implements ClassService {

    @Autowired
    private ClassMapper classMapper;

    @Override
    public List<Class> findByMajorId(Integer majorid) {
        return classMapper.selectByMajorid(majorid);
    }

    @Override
    public List<Class> findByCondition(Class clazz) {
        return classMapper.selectByCondition(clazz);
    }

    @Override
    public Class findById(Integer id) {
        return classMapper.selectByPrimaryKey(id);
    }

    @Override
    public void add(Class clazz) {
        classMapper.insertSelective(clazz);
    }
}
